//package com.yiwei.zhh.adapter;
//
//import android.content.Context;
//import android.content.Intent;
//import android.support.v7.widget.RecyclerView;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.LinearLayout;
//import android.widget.RelativeLayout;
//import android.widget.TextView;
//
//import com.yiwei.zhh.activity.DealDetailActivity;
//import com.yiwei.zhh.R;
//import com.yiwei.zhh.interfaces.OnRecyclerViewListener;
//import com.yiwei.zhh.model.DealDetailModel;
//
//import java.util.List;
//
//
///**
// * 交易明细
// * Created by MasterDong on 16/4/12.
// */
//
//public class DealDetaiAdapter extends RecyclerView.Adapter {
//
//
//    private OnRecyclerViewListener onRecyclerViewListener;
//
//    public void setOnRecyclerViewListener(OnRecyclerViewListener onRecyclerViewListener) {
//        this.onRecyclerViewListener = onRecyclerViewListener;
//    }
//
//    private Context mContext;
//    private List<DealDetailModel.DataList> list;
//    private int type;
//
//    public DealDetaiAdapter(Context context, List<DealDetailModel.DataList> list, int type) {
//        this.list = list;
//        this.mContext = context;
//        this.type = type;
//    }
//
//    @Override
//    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
//        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.deal_detail_items, null);
//        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
//        view.setLayoutParams(lp);
//        return new DealViewHolder(view);
//    }
//
//    @Override
//    public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
//        DealViewHolder holder = (DealViewHolder) viewHolder;
//        holder.position = i;
//        DealDetailModel.DataList mode = list.get(i);
//        holder.date.setText(mode.getCreate_time_format());
//        holder.money.setText(mode.getMoney());
//        holder.type.setText(mode.getType_name());
//
//        if (i == 9 && list.size() <= 10 && type == 1) holder.more.setVisibility(View.VISIBLE);
//
//        holder.more.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                mContext.startActivity(new Intent(mContext, DealDetailActivity.class));
//            }
//        });
//
//    }
//
//    /**
//     * 添加数据
//     *
//     * @param list
//     */
//    public void addList(List<DealDetailModel.DataList> list) {
//        this.list.addAll(list);
//    }
//
//    public void clearList() {
//        this.list.clear();
//    }
//
//    @Override
//    public int getItemCount() {
//        return list.size();
//    }
//
//    class DealViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
//        public View rootView;
//        public TextView money;
//        public TextView type;
//        public TextView date;
//        public int position;
//        public RelativeLayout more;
//
//        public DealViewHolder(View itemView) {
//            super(itemView);
//            date = (TextView) itemView.findViewById(R.id.date);
//            money = (TextView) itemView.findViewById(R.id.money);
//            type = (TextView) itemView.findViewById(R.id.type);
//            more = (RelativeLayout) itemView.findViewById(R.id.more);
//
//            rootView = itemView.findViewById(R.id.loan_record_item);
//            rootView.setOnClickListener(this);
//            rootView.setOnLongClickListener(this);
//        }
//
//        @Override
//        public void onClick(View v) {
//            if (null != onRecyclerViewListener) {
//                onRecyclerViewListener.onItemClick(list, position);
//            }
//        }
//
//        @Override
//        public boolean onLongClick(View v) {
//            if (null != onRecyclerViewListener) {
//                return onRecyclerViewListener.onItemLongClick(list, position);
//            }
//            return false;
//        }
//
//    }
//}
//
